<div class="title">Xử lý hồ sơ</div>
<div id="buttons">
	<?php echo $this->Html->link('Nội dung HS',array('action' => 'xemHoso', $selectedHoso), array('class' => 'button blue','id'=> 'xemHoso'));?>
	<?php echo $this->Html->link('Phiếu trình',array('action' => 'lapPhieuTrinh', $selectedHoso), array('id' => 'history', 'class' => 'button blue'));?>
	<?php echo $this->Html->link('Vào sổ theo dõi kết quả hành chính',array('action' => 'ketquahanhchinh', $selectedHoso), array('id' => 'vaoso', 'class' => 'button blue'));?>
	<?php echo $this->Html->link('Thoát',array('action' => 'back'), array('id' => 'back', 'class' => 'button blue'));?>
</div>
<hr style="color: #1F7BC3;" />
<div id="formXuly">
	<?php if (isset($errors) && !empty($errors)): ?>
				<div id="errors">
					<ul>
						<?php foreach ($errors as $rules):
							foreach ($rules as $key => $error):
							?>
							<li><?php echo $error;?></li>
						<?php endforeach; endforeach ?>
					</ul>
				</div>
				<?php endif ?>
				<?php echo $this->Session->flash();?>
	<?php echo $this->Form->create('Hoso', array('inputDefaults' => array('error' => false),'id'=>'XuLy')); ?>
	<div id="generalInfo">
		<p>
			<span class="title">TTHC</span>
			<span><input disabled="true" value="<?php echo $hoso['Tthc']['ten']?>" style="width: 250px;"/></span>
			<span class="title2">Mã hồ sơ</span>
			<span><input disabled="true" value="<?php echo $hoso['Hoso']['code'];?>" style="width: 100px;"/></span>
			<span class="title3">Email</span>
			<span><input disabled="true" value="<?php echo $hoso['Hoso']['email'];?>" style="width: 332px;"/></span>
		</p>
		<p>
			<span class="title">Họ tên</span>
			<span><input disabled="true" value="<?php echo $hoso['Hoso']['ten'];?>" style="width: 250px;"/></span>
			<span class="title2">Địa chỉ</span>
			<span><input disabled="true" value="<?php echo $hoso['Hoso']['dia_chi'];?>" style="width: 523px;"/></span>
		</p>
		<p>
			<span class="title">Về việc</span>
			<span><input value="<?php echo $hoso['Hoso']['ghi_chu'];?>" style="width: 865px;" <?php echo $enable == 0?"disabled":""?>/></span>
		</p>
		<p>
			<span class="title">Ngày hẹn trả</span>
			<span><input disabled="true" value="<?php echo $this->Time->format('d/m/Y',$hoso['Hoso']['ngay_hen_tra']);?>" style="width: 128px;"/></span>
			<?php if(isset($qua_han)):?>
			<span class="title3" style="background-color: red;font-weight: bold; padding:5px; width: 80px; margin-left: 107px;">Ngày quá hẹn</span>
			<span><input disabled="true" value="<?php echo $qua_han;?>"/></span>
			<?php endif;?>
		</p>
		<table width="100%" cellspacing="0">
			<tr>
				<td>Trạng thái</td>
				<td>Ngày thực hiện</td>
				<td>Người thực hiện</td>
				<td>Nội dung giải quyết</td>
				<td>Số ngày còn lại</td>
			</tr>
			<?php foreach ($his as $key => $hi):?>
			<tr>
				<td><?php echo $this->Status->status($hi['LichsuHoso']['status']);?></td>
				<td align="center"><?php echo $this->Time->format('d/m/Y',$hi['LichsuHoso']['created']);?></td>
				<td><?php echo $hi['User']['ho_ten'];?></td>
				<td><?php echo $hi['LichsuHoso']['noi_dung_giai_quyet'];?></td>
				<td align="center"><?php echo $hi['LichsuHoso']['so_ngay_con_lai'];?></td>
			</tr>
			<?php endforeach; ?>
		</table>
		<p>
			<span class="title">Ngày xử lý</span>
			<span><input disabled="true" value="<?php echo $this->Time->format('d/m/Y', date('d-m-Y'));?>" style="width: 128px;"/></span>
		</p>
		<p>
			<span class="title">Nội dung xử lý</span>
			<span><input name="data[Hoso][noidungxuly]" value="<?php echo $hoso['Hoso']['noidungxuly'];?>" style="width: 865px;" <?php echo $enable == 0?"disabled":""?>/></span>
		</p>
		<?php if ($enable == 1): ?>
		<p>
			<span class="title">Kết luận</span>
			<span><input value="68" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 68?"checked":"";?>/><span style="width: 120px;">Hồ sơ đang xử lý</span>
			<span><input value="62" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 62?"checked":"";?>/><span style="width: 200px;">Hồ sơ không đủ điều kiện, trả lại</span>
			<span><input value="63" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 63?"checked":"";?>/><span style="width: 200px;">Hồ sơ không đủ điều kiện, bổ sung thêm</span>
		</p>
		<p>
			<span class="title"> </span>
			<span><input value="64" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 64?"checked":"";?>/><span style="width: 120px;">Hồ sơ đạt yêu cầu</span>
			<span><input value="66" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 66?"checked":"";?>/><span style="width: 200px;">Hồ sơ hoàn thiện chuyển lưu trữ</span>
			<span><input value="67" type="radio" name="data[Hoso][status]" <?php echo $hoso['Hoso']['trang_thai'] == 67?"checked":"";?>/><span style="width: 200px;">Hồ sơ phức tạp, chuyển tồn đọng</span>
		</p>
		<?php endif; ?>
	</div>
	<?php if ($enable == 1):?>
	<hr style="color: #1F7BC3;" />
	<div id="buttons" style="text-align: center;">
		<button class="button blue" id="duyet">Lưu</button>
	</div>
	<?php endif; ?>
    <input type="hidden" name="data[Hoso][id]" value="<?php echo $hoso['Hoso']['id'];?>"/> 
	<?php echo $this->Form->end();?>
</div>
<?php if ($enable == 1):?>
<script type="text/javascript">
	var form = $("#XuLy");
	$(document).ready(function (){
		$("#duyet").click(function () {
			if ($("input[type=radio]:checked").length < 1) {
				alert("Chọn trang thái kết luận khi lưu");
			} else {
				submit('xuly',form);
			}
		});
	});
</script>
<?php endif; ?>